﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;

public partial class SubscribersMsgs : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected override void InitializeCulture()
    {
        if (Session["CurrentCulture"] != null)
        {
            string lang = Session["CurrentCulture"].ToString();
            if (lang != null && lang != "")
            {
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang);
                Thread.CurrentThread.CurrentCulture.DateTimeFormat = new CultureInfo("en-US", false).DateTimeFormat;
                // Thread.CurrentThread.CurrentCulture.Calendar=new  System.Globalization.GregorianCalendar();

            }
        }
    }

    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {

        //if (e.Row.RowType == DataControlRowType.DataRow)
        //{
        //    e.Row.Attributes.Add("onmouseover", "this.Mystyle=this.style.backgroundColor;this.style.backgroundColor='#FFFFA8'");

        //    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.Mystyle");

        //}

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer'");

            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='default'");
            
        }
    }
    protected void GridView2_RowCreated(object sender, GridViewRowEventArgs e)
    {

        //if (e.Row.RowType == DataControlRowType.DataRow)
        //{
        //    e.Row.Attributes.Add("onmouseover", "this.Mystyle=this.style.backgroundColor;this.style.backgroundColor='#FFFFA8'");

        //    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.Mystyle");

        //}
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer'");

            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='default'");

        }
    }
    
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string dd = e.Row.FindControl("msg").ClientID;
            e.Row.Attributes.Add("onclick", "javascript:return quickread('" + dd + "');");

        }
    }
    protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string ddd = e.Row.FindControl("msg").ClientID;
            e.Row.Attributes.Add("onclick", "javascript:return quickread('" + ddd + "');");
          Label lab= (Label)e.Row.FindControl("reps");
         int dd=int.Parse(lab.ToolTip);
         if (dd >0)
         {

             lab.Text = this.GetLocalResourceObject("reply").ToString();
         }
         else
         {
             lab.Text = this.GetLocalResourceObject("new").ToString();
         
         }
        }
    }

    protected void edit_Click(object sender, EventArgs e)
    {
        LinkButton lk = (LinkButton)sender;
        //Sendmail1.sets(lk.ToolTip + "," + "reply_id");


        //// Page.ClientScript.RegisterStartupScript(this.GetType(), "reports", "there();", true);
        //ScriptManager.RegisterStartupScript(this.up1, this.GetType(), "hj", "there();", true);

    }
    protected void edit2_Click(object sender, EventArgs e)
    {
        LinkButton lk = (LinkButton)sender;
        if (!string.IsNullOrEmpty(lk.ToolTip))
        {
            Sendmail1.sets(lk.ToolTip ,RoleEnum.Admin,RoleEnum.Organization,lk.CommandArgument,"");


            //Page.ClientScript.RegisterStartupScript(this.GetType(), "reports", "there();", true);
            ScriptManager.RegisterStartupScript(this.up1, this.GetType(), "hj", "there();", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.up1, this.GetType(), "hj", "window.alert('no email specified for organization')", true);
        }

    }
   
}
